package com.linkage.jz.bankruptcy.bean.Vote;

import com.linkage.jz.bankruptcy.adapter.Vote.ExpandableRecyclerAdapter;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ProVoteVoters extends ExpandableRecyclerAdapter.ListItem implements Serializable {

    public static final int TYPE_GROUP = 1000;
    public static final int TYPE_PERSON = 1001;

    public static final String Claims_TYPE_SW = "税务";
    public static final String Claims_TYPE_DBYX = "担保优先";
    public static final String Claims_TYPE_QTYX = "其他优先";
    public static final String Claims_TYPE_NOR = "普通";

    private boolean checked;
    // TODO 联调时重写，字段需与接口一致
    private long id;
    private String avatar;
    private String name;
    private String sureMoney;
    private String voteMoney;
    private int claimsType;//债权种类

    public boolean isDeclareAsVote() {
        return declareAsVote;
    }

    public void setDeclareAsVote(boolean declareAsVote) {
        this.declareAsVote = declareAsVote;
    }

    private boolean declareAsVote;

    public static ProVoteVoters parseJson(JSONObject jsonObj) {
        // TODO 联调时重写，解析代码
        ProVoteVoters proVoteVoters = new ProVoteVoters();
        return proVoteVoters;
    }

    public static List<ProVoteVoters> parseJson(JSONArray jsonArray) {
        List<ProVoteVoters> list = new ArrayList<ProVoteVoters>();
        if (jsonArray != null && jsonArray.length() > 0) {
            for (int i = 0; i < jsonArray.length(); i++) {
                ProVoteVoters item = parseJson(jsonArray.optJSONObject(i));
                if (item != null)
                    list.add(item);
            }
        }
        return list;
    }

    public static List<ProVoteVoters> parseJson(int page) {
        List<ProVoteVoters> list = new ArrayList<ProVoteVoters>();
        for(int i=1;i<=3;i++) {
            ProVoteVoters proVoteVoters = new ProVoteVoters();
            proVoteVoters.setId((page-1)*10 + i);
            proVoteVoters.setName("徐晓燕" + proVoteVoters.getId());
            proVoteVoters.setSureMoney(proVoteVoters.getId()*100 + "");
            proVoteVoters.setVoteMoney("7890,000.00");
            proVoteVoters.setClaimsType((int)(proVoteVoters.getId() % 4) + 1);
            list.add(proVoteVoters);
        }
        return list;
    }

    public static List<ProVoteVoters> parseJson(int group, int page) {
        List<ProVoteVoters> list = new ArrayList<ProVoteVoters>();
        for(int i=1;i<=2;i++) {
            ProVoteVoters proVoteVoters = new ProVoteVoters();
            proVoteVoters.setId((group-1)*10 + i);
            proVoteVoters.setName("徐晓燕" + proVoteVoters.getId());
            proVoteVoters.setSureMoney(proVoteVoters.getId()*100 + "");
            proVoteVoters.setVoteMoney("7890,000.00");
            proVoteVoters.setClaimsType((int)(proVoteVoters.getId() % 4) + 1);
            list.add(proVoteVoters);
            list.addAll(parseJson(page));
        }
        return list;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSureMoney() {
        return sureMoney;
    }

    public void setSureMoney(String sureMoney) {
        this.sureMoney = sureMoney;
    }

    public String getVoteMoney() {
        return voteMoney;
    }

    public void setVoteMoney(String voteMoney) {
        this.voteMoney = voteMoney;
    }

    public int getClaimsType() {
        return claimsType;
    }

    public void setClaimsType(int claimsType) {
        this.claimsType = claimsType;
    }
}
